<template>
  <div class="q-pa-md q-gutter-md">
    <t-btn push color="teal" label="Toggle" @click="toggle" />

    <!-- using v-if so you can see the effect -->
    <t-img
      v-if="url !== null"
      :src="url"
      :ratio="1"
      class="q-mt-md"
      style="width: 150px"
      placeholder-src=""
    />
  </div>
</template>

<script>
  import { ref } from 'vue';

  export default {
    setup() {
      const url = ref(null);

      return {
        url,
        toggle() {
          url.value =
            url.value === null
              ? 'https://picsum.photos/500/300?t=' + Math.random()
              : null;
        },
      };
    },
  };
</script>
